import { SessionStorage, Storage } from '@/utils/storage'
import Constant from '@/utils/constant'
import { ITheme } from '@/store/theme/ITheme'
import { themeConfig } from '@/store/theme/ThemeConfig'

class Cache{

    //左侧菜单是否打开
    getSidebarOpened = (): boolean => {
		return Storage.getItem(Constant.SidebarOpenedKey) || false
	}

	setSidebarOpened = (value: boolean) => {
		Storage.setItem(Constant.SidebarOpenedKey, value)
	}

	//主题配置
	getTheme = (): ITheme => {
		return (SessionStorage.getItem(Constant.ThemeKey) as ITheme) || themeConfig
	}

	setTheme = (value: ITheme) => {
		SessionStorage.setItem(Constant.ThemeKey, value)
	}


	//token
	getToken = (): string => {
		return Storage.getItem(Constant.TokenKey) || ''
	}

	setToken = (value: string) => {
		Storage.setItem(Constant.TokenKey, value)
	}

    

}

export default new Cache()